package com.csun.dsms.controller;


import com.csun.dsms.comment.config.properties.CsunProperties;
import com.csun.dsms.comment.core.annotation.Authorization;
import com.csun.dsms.comment.core.utils.wrapper.WrapMapper;
import com.csun.dsms.comment.core.utils.wrapper.Wrapper;
import com.csun.dsms.model.domain.DsmsResource;
import com.csun.dsms.model.huang.*;
import com.csun.dsms.service.*;
import com.csun.dsms.utils.*;
import com.csun.dsms.utils.pt.HuangGangUtil;
import com.csun.dsms.utils.pt.OAUtils;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

/**
 * @desc    用户登录拦截器
 */
@Slf4j
@RestController
@RequestMapping("/hg")
public class HuangGangController {

    @Resource
    private HgInstructionDataService hgInstructionDataService;

    @Resource
    private OSSManageUtil ossManageUtil;
    @Resource
    private CsunProperties csunProperties;
    @Autowired
    private HgUserService hgUserService;

    @Resource
    private HgPushCycleService hgPushCycleServiceImpl;

    /**
     * 新增批示
     * @param instructionListData
     * @return
     */
    @Authorization
    @RequestMapping(value = "/instructionAdd",method = RequestMethod.POST)
    public Wrapper instructionAdd (@RequestBody HgInstructionListData instructionListData){
        if(PublicUtil.isEmpty(instructionListData.getPagePath().trim())){
            return WrapMapper.wrap(Wrapper.ERROR_CODE,"页面不能不空");
        }
        instructionListData.setCreatedTime(new Date());
        Integer save = hgInstructionDataService.save(instructionListData);
        if (instructionListData.getApprovedPhone()!=null){
            HgUser hgUser = hgUserService.selectByPhone(instructionListData.getApprovedPhone());
            HuangGangUtil.sendMsg(instructionListData,hgUser.getHuangGangId());
            if (hgUser.getOaUserId()!=null){
                OAUtils.sendTodo(instructionListData,hgUser.getOaUserId());
            }
        }
        if(save<1){
            return WrapMapper.wrap(Wrapper.ERROR_CODE,Wrapper.ERROR_MESSAGE);
        }
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE);
    }

    /*
     * 查询批示
     * */
    @Authorization
    @RequestMapping(value = "/instructionListQuery",method = RequestMethod.POST)
    public Wrapper instructionListQuery (@RequestBody HgQueryDto hgQueryDto){
        List<HgInstructionListData> query = hgInstructionDataService.queryInstructionList(hgQueryDto);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE,new PageInfo<>(query));
    }


    /**
     * 阅读批示
     * @param instructionListData
     * @return
     */
    @Authorization
    @RequestMapping(value = "/instructionRead",method = RequestMethod.POST)
    public Wrapper instructionRead (@RequestBody HgInstructionListData instructionListData){
        if(instructionListData.getId() == null){
            return WrapMapper.wrap(Wrapper.ERROR_CODE,"未选择批示");
        }
        HgInstructionListData instructionListData1 = hgInstructionDataService.selectByKey(instructionListData.getId());
        instructionListData1.setReadTime(new Date());
        instructionListData1.setIsViewed(1);
        Integer save = hgInstructionDataService.update(instructionListData1);
        if(save<1){
            return WrapMapper.wrap(Wrapper.ERROR_CODE,Wrapper.ERROR_MESSAGE);
        }
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE);
    }




    /**
     * 资源上传 -- 小程序
     */
    @Authorization
    @RequestMapping(value="/uploadFile",method= RequestMethod.POST,produces="application/json")
    public Wrapper uploadFile(HttpServletResponse response,
                              HttpServletRequest request) throws Throwable {
        /* 获取文件描述参数 */
        String remark = request.getParameter("remark");
        List<DsmsResource> resources = new ArrayList<DsmsResource>();
        /* 将当前上下文初始化给  CommonsMutipartResolver （多部分解析器）*/
        CommonsMultipartResolver multipartResolver=new CommonsMultipartResolver(
                request.getSession().getServletContext());
        /* 检查form中是否有enctype="multipart/form-data" */
        if(multipartResolver.isMultipart(request)) {
            /* 将request变成多部分request */
            MultipartHttpServletRequest multiRequest=(MultipartHttpServletRequest)request;

            /* 获取multiRequest 中所有的文件名*/
            Iterator iter = multiRequest.getFileNames();
            String timedate  = DateUtil.getOrderNum();	// 时间戳,避免文件覆盖

            while(iter.hasNext()) {
                //一次遍历所有文件
                MultipartFile file = multiRequest.getFile(iter.next().toString());
                if(file != null) {
                    /* 文件属性获取 */
                    SourceType sourceType = MimeTypeUtil.getSourceType(file.getContentType());
                    /* MultipartFile 转 File */
                    File f=File.createTempFile("tmp", null);
                    file.transferTo(f);
                    f.deleteOnExit();
                    /* OSS文件上传 */
                    ossManageUtil.uploadFile(f, file.getOriginalFilename(), file.getContentType(), sourceType
                            .getSourceTypePath() + "/" + timedate);
                    /* 保存上传的文件属性 */
                    DsmsResource r = new DsmsResource();
                    r.setResourceName(file.getOriginalFilename());
                    r.setResourcePath(csunProperties.getAliyun().getOss().getAccessUrl() + "/"
                            + sourceType.getSourceTypePath() + "/" + timedate + "/" + file.getOriginalFilename());
                    if (StringUtils.isNotBlank(remark)) {
                        r.setRemark(remark);
                    }
                    r.setResourceTypeId(Integer.parseInt(sourceType.getSourceTypeId()));
                    resources.add(r);
                }
            }
        }

        return WrapMapper.ok(resources);
    }


    @GetMapping("/downGdpTemplate")
    public void downGdpTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "地区生产总值导入模板表";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String qStr = "统计季度";
        String areaName = "区划地名";
        String industry = "行业类型(可不填)";
        String gdp = "地区生产总值";
        String ranking = "地区生产总值排名";
        String growthGdp = "GDP增加值";
        String growthRate = "GDP增速(不用百分号)";
        String topRate = "上级GDP增速(不用百分号)";
        String growthRateRanking = "增加值增速排名";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        //exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(0);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(qStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第4列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(industry));
        sheet.setColumnWidth(3, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(gdp));
        sheet.setColumnWidth(4, 20 * 256);
        //第一行第6列
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(ranking));
        sheet.setColumnWidth(5, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthGdp));
        sheet.setColumnWidth(6, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthRate));
        sheet.setColumnWidth(7, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(topRate));
        sheet.setColumnWidth(8, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthRateRanking));
        sheet.setColumnWidth(9, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(10);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(10, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(11);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(11, 20 * 256);

        //定义第二行开始后的实体内容
//        HSSFRow row = sheet.createRow(2);
//        HSSFCell cell = row.createCell(1);
//        for (int i = 0; i < dsmsRecords.size(); i++) {
//            DsmsRecord record = JSON.parseObject(JSONObject.toJSONString(dsmsRecords.get(i)), DsmsRecord.class);
//            row = sheet.createRow(i + 2);
//            cell = row.createCell(0);
//            cell.setCellStyle(cellStyle);
//            cell.setCellValue(new HSSFRichTextString(record.getStaffName()));
//        }

        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downFixedDataTemplate")
    public void downFixedDataTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "县市区固定资产投资导入模板表";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "区划地名";
        String growthRate = "增速";
        String ranking = "综合排名";
        String contRate = "投资贡献率(不用百分号)";
        String inStock = "在库剩余投资(亿元)";
        String newStock = "新入库投资(亿元)";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthRate));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第6列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(ranking));
        sheet.setColumnWidth(4, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(contRate));
        sheet.setColumnWidth(5, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(inStock));
        sheet.setColumnWidth(6, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newStock));
        sheet.setColumnWidth(7, 20 * 256);
        //第一行第7列
        //第一行第7列
        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(8, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(9, 20 * 256);

        //定义第二行开始后的实体内容
//        HSSFRow row = sheet.createRow(2);
//        HSSFCell cell = row.createCell(1);
//        for (int i = 0; i < dsmsRecords.size(); i++) {
//            DsmsRecord record = JSON.parseObject(JSONObject.toJSONString(dsmsRecords.get(i)), DsmsRecord.class);
//            row = sheet.createRow(i + 2);
//            cell = row.createCell(0);
//            cell.setCellStyle(cellStyle);
//            cell.setCellValue(new HSSFRichTextString(record.getStaffName()));
//        }

        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downFixedIndustrialTemplate")
    public void downFixedIndustrialTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "行业固定资产投资导入模板表";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String industrial = "行业领域";
        String growthRate = "投资增速";
        String completeRate = "年度投资完成度";
        String department = "责任部门";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        //第一行第5列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(industrial));
        sheet.setColumnWidth(2, 20 * 256);
        //第一行第6列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthRate));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第7列
        //第一行第7列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(completeRate));
        sheet.setColumnWidth(4, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(department));
        sheet.setColumnWidth(5, 20 * 256);
        //第一行第7列
        //第一行第7列
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(6, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(7, 20 * 256);

        //定义第二行开始后的实体内容
//        HSSFRow row = sheet.createRow(2);
//        HSSFCell cell = row.createCell(1);
//        for (int i = 0; i < dsmsRecords.size(); i++) {
//            DsmsRecord record = JSON.parseObject(JSONObject.toJSONString(dsmsRecords.get(i)), DsmsRecord.class);
//            row = sheet.createRow(i + 2);
//            cell = row.createCell(0);
//            cell.setCellStyle(cellStyle);
//            cell.setCellValue(new HSSFRichTextString(record.getStaffName()));
//        }

        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downFactoryDataTemplate")
    public void downFactoryDataTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "各县市区规上工业增加值增速";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "区划地名";
        String growthRate = "增加值增速";
        String ranking = "排名";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthRate));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第6列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(ranking));
        sheet.setColumnWidth(4, 20 * 256);
        //第一行第7列
        //第一行第7列
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(5, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(6, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downFactoryIndustrialTemplate")
    public void downFactoryIndustrialTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "全市主导产业情况导入模板表";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String industrial = "行业类型";
        String total = "完成产值(亿元)";
        String growthRate = "同比增速(不用百分号)";
        String zhanbi = "占比(不用百分号)";
        String companyNum = "企业数";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        //第一行第5列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(industrial));
        sheet.setColumnWidth(2, 20 * 256);
        //第一行第6列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthRate));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第7列
        //第一行第7列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(total));
        sheet.setColumnWidth(4, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthRate));
        sheet.setColumnWidth(5, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(zhanbi));
        sheet.setColumnWidth(6, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(companyNum));
        sheet.setColumnWidth(7, 20 * 256);
        //第一行第7列
        //第一行第7列
        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(8, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(9, 20 * 256);
        //定义第二行开始后的实体内容
//        HSSFRow row = sheet.createRow(2);
//        HSSFCell cell = row.createCell(1);
//        for (int i = 0; i < dsmsRecords.size(); i++) {
//            DsmsRecord record = JSON.parseObject(JSONObject.toJSONString(dsmsRecords.get(i)), DsmsRecord.class);
//            row = sheet.createRow(i + 2);
//            cell = row.createCell(0);
//            cell.setCellStyle(cellStyle);
//            cell.setCellValue(new HSSFRichTextString(record.getStaffName()));
//        }

        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }




    @GetMapping("/downConsumptionDataTemplate")
    public void downConsumptionDataTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "县市区社会消费品零售总额导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "区划地名";
        String total = "社零总额(亿元)";
        String growthRate = "社零增速";
        String ranking = "排名";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(total));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(growthRate));
        sheet.setColumnWidth(4, 20 * 256);
        //第一行第6列
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(ranking));
        sheet.setColumnWidth(5, 20 * 256);
        //第一行第7列
        //第一行第7列
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(6, 20 * 256);
        //第一行第7列
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(7, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }



    @GetMapping("/downInvestmentDataTemplate")
    public void downInvestmentDataTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "县市区招商引资项目情况导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "区划地名";
        String newNum1 = "新签约项目全年目标个数";
        String newNum2 = "新签约项目完成个数";
        String newNum3 = "新签约项目个数完成比例";
        String newNum4 = "新签约项目个数同比增速";
        String newNum5 = "新签约项目协议投资额全年目标(亿元)";
        String newNum6 = "新签约项目协议投资额完成情况(亿元)";
        String newNum7 = "新签约项目协议投资额完成比例";
        String newNum8 = "新签约项目协议投资额同比增速";
        String openNum1 = "新开工入库项目个数全年目标";
        String openNum2 = "新开工入库项目完成个数";
        String openNum3 = "新开工入库项目完成比例";
        String openNum4 = "新开工入库项目同比增速";
        String kuNum1 = "招商引资在库项目本年完成投资额全年目标(亿元)";
        String kuNum2 = "招商引资在库项目本年完成投资额完成情况(亿元)";
        String kuNum3 = "招商引资在库项目本年完成投资额完成比例";
        String kuNum4 = "招商引资在库项目本年完成投资额同比增速";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum4));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum5));
        sheet.setColumnWidth(7, 20 * 256);
        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum6));
        sheet.setColumnWidth(8, 20 * 256);
        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum7));
        sheet.setColumnWidth(9, 20 * 256);
        cell1 = row1.createCell(10);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum8));
        sheet.setColumnWidth(10, 20 * 256);
        cell1 = row1.createCell(11);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(openNum1));
        sheet.setColumnWidth(11, 20 * 256);
        cell1 = row1.createCell(12);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(openNum2));
        sheet.setColumnWidth(12, 20 * 256);
        cell1 = row1.createCell(13);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(openNum3));
        sheet.setColumnWidth(13, 20 * 256);
        cell1 = row1.createCell(14);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(openNum4));
        sheet.setColumnWidth(14, 20 * 256);
        cell1 = row1.createCell(15);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(kuNum1));
        sheet.setColumnWidth(15, 20 * 256);
        cell1 = row1.createCell(16);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(kuNum2));
        sheet.setColumnWidth(16, 20 * 256);
        cell1 = row1.createCell(17);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(kuNum3));
        sheet.setColumnWidth(17, 20 * 256);
        cell1 = row1.createCell(18);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(kuNum4));
        sheet.setColumnWidth(18, 20 * 256);
        cell1 = row1.createCell(19);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(19, 20 * 256);
        cell1 = row1.createCell(20);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(20, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }



    @GetMapping("/downInvestmentPartTemplate")
    public void downInvestmentPartTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "市区各招商专班工作开展情况导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "区划地名";
        String newNum1 = "专班";
        String newNum2 = "外出招商";
        String newNum3 = "接待客商";
        String newNum4 = "再谈项目";
        String newNum5 = "签约项目";
        String newNum6 = "协议投资额(亿元)";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum4));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum5));
        sheet.setColumnWidth(7, 20 * 256);

        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum6));
        sheet.setColumnWidth(8, 20 * 256);

        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(9, 20 * 256);
        cell1 = row1.createCell(10);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(10, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downFinancialDataTemplate")
    public void downFinancialDataTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "县市区争取资金情况导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "区划地名";
        String newNum1 = "中央和省预算内资金完成额度(亿元)";
        String newNum2 = "中央和省预算内资金目标额度(亿元)";
        String newNum3 = "两重两新超长期特别国债完成额度(亿元)";
        String newNum4 = "两重两新超长期特别国债目标额度(亿元)";
        String newNum5 = "地方政府专项债完成额度(亿元)";
        String newNum6 = "地方政府专项债目标额度(亿元)";
        String newNum7 = "其他专项资金完成额度(亿元)";
        String newNum8 = "其他专项资金目标额度(亿元)";
        String openNum1 = "合计完成额度(亿元)";
        String openNum2 = "合计目标额度(亿元)";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum4));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum5));
        sheet.setColumnWidth(7, 20 * 256);
        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum6));
        sheet.setColumnWidth(8, 20 * 256);
        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum7));
        sheet.setColumnWidth(9, 20 * 256);
        cell1 = row1.createCell(10);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum8));
        sheet.setColumnWidth(10, 20 * 256);
        cell1 = row1.createCell(11);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(openNum1));
        sheet.setColumnWidth(11, 20 * 256);
        cell1 = row1.createCell(12);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(openNum2));
        sheet.setColumnWidth(12, 20 * 256);

        cell1 = row1.createCell(13);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(13, 20 * 256);
        cell1 = row1.createCell(14);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(14, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downFinancialIndustrialTemplate")
    public void downFinancialIndustrialTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "行业争取资金情况导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "责任部门";
        String newNum1 = "中央和省预算内资金完成额度(亿元)";
        String newNum2 = "中央和省预算内资金目标额度(亿元)";
        String newNum3 = "两重两新超长期特别国债完成额度(亿元)";
        String newNum4 = "两重两新超长期特别国债目标额度(亿元)";
        String newNum5 = "地方政府专项债完成额度(亿元)";
        String newNum6 = "地方政府专项债目标额度(亿元)";
        String newNum7 = "其他专项资金完成额度(亿元)";
        String newNum8 = "其他专项资金目标额度(亿元)";
        String openNum1 = "合计完成额度(亿元)";
        String openNum2 = "合计目标额度(亿元)";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum4));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum5));
        sheet.setColumnWidth(7, 20 * 256);
        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum6));
        sheet.setColumnWidth(8, 20 * 256);
        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum7));
        sheet.setColumnWidth(9, 20 * 256);
        cell1 = row1.createCell(10);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum8));
        sheet.setColumnWidth(10, 20 * 256);
        cell1 = row1.createCell(11);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(openNum1));
        sheet.setColumnWidth(11, 20 * 256);
        cell1 = row1.createCell(12);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(openNum2));
        sheet.setColumnWidth(12, 20 * 256);

        cell1 = row1.createCell(13);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(13, 20 * 256);
        cell1 = row1.createCell(14);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(14, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downFinancialProjectTemplate")
    public void downFinancialProjectTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "争取资金项目清单导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "项目区划";
        String newNum1 = "项目行业";
        String newNum2 = "项目名称";
        String newNum3 = "资金需求(亿元)";
        String newNum4 = "申报资金批次";
        String newNum5 = "建议跟踪对接单位";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum4));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum5));
        sheet.setColumnWidth(7, 20 * 256);

        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(8, 20 * 256);
        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(9, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }



    @GetMapping("/downProjectDataTemplate")
    public void downProjectDataTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "县市区重点项目“一人一档”导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "区划地名";
        String newNum1 = "项目个数";
        String newNum2 = "红榜项目个数";
        String newNum3 = "黑榜项目个数";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);


        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(7, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downProjectIndustrialTemplate")
    public void downProjectIndustrialTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "行业领域重点项目“一人一档”导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "行业领域";
        String newNum1 = "项目个数";
        String newNum2 = "红榜项目个数";
        String newNum3 = "黑榜项目个数";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);


        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(7, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downProjectProjectTemplate")
    public void downProjectProjectTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "红黑榜项目清单导入模版";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "项目区划";
        String newNum1 = "项目行业";
        String newNum2 = "项目名称";
        String newNum3 = "包保责任人";
        String newNum4 = "包保责任人职务";
        String newNum5 = "红黑榜类型(红榜/黑榜)";
        String newNum6 = "列入榜单原因";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum4));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum5));
        sheet.setColumnWidth(7, 20 * 256);
        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum6));
        sheet.setColumnWidth(8, 20 * 256);

        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(9, 20 * 256);
        cell1 = row1.createCell(10);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(10, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @GetMapping("/downMarketDataTemplate")
    public void downMarketDataTemplate(HttpServletResponse response) {
        HSSFWorkbook wb = new HSSFWorkbook();
        String worksheetTitle = "县市区四上企业进规入限个数导入模板";
        // 创建单元格样式
        HSSFCellStyle cellStyleTitle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时不换行
        cellStyleTitle.setWrapText(false);
        // ------------------------------------------------------------------
        HSSFCellStyle cellStyle = wb.createCellStyle();
        // 指定单元格居中对齐
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        // 指定单元格垂直居中对齐
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        // 指定当单元格内容显示不下时换行
        cellStyle.setWrapText(true);

        // ------------------------------------------------------------------
        // 设置单元格字体
        HSSFFont font = wb.createFont();
         font.setBold(true);
        font.setFontName("宋体");
        font.setFontHeight((short) 200);
        cellStyleTitle.setFont(font);

        // 工作表名
        String yearStr = "统计年度";
        String monthStr = "统计月度";
        String areaName = "项目区划";
        String newNum1 = "工业个数";
        String newNum2 = "建筑业个数";
        String newNum3 = "商贸个数";
        String newNum4 = "房地产个数";
        String newNum5 = "服务业个数";
        String newNum6 = "合计个数";
        String creator = "填报人";
        String entryDepartment = "填报部门";

        HSSFSheet sheet = wb.createSheet();
        ExportExcel exportExcel = new ExportExcel(wb, sheet);
        // 创建报表头部
        exportExcel.createNormalHead(worksheetTitle, 11);
        // 定义第一行
        HSSFRow row1 = sheet.createRow(1);
        //第一行第1列
        HSSFCell cell1 = row1.createCell(0);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(yearStr));
        sheet.setColumnWidth(0, 20 * 256);;
        //第一行第2列
        cell1 = row1.createCell(1);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(monthStr));
        sheet.setColumnWidth(1, 20 * 256);
        //第一行第3列
        cell1 = row1.createCell(2);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(areaName));
        sheet.setColumnWidth(2, 20 * 256);

        //第一行第5列
        cell1 = row1.createCell(3);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum1));
        sheet.setColumnWidth(3, 20 * 256);
        //第一行第5列
        cell1 = row1.createCell(4);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum2));
        sheet.setColumnWidth(4, 20 * 256);
        cell1 = row1.createCell(5);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum3));
        sheet.setColumnWidth(5, 20 * 256);
        cell1 = row1.createCell(6);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum4));
        sheet.setColumnWidth(6, 20 * 256);
        cell1 = row1.createCell(7);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum5));
        sheet.setColumnWidth(7, 20 * 256);
        cell1 = row1.createCell(8);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(newNum6));
        sheet.setColumnWidth(8, 20 * 256);

        cell1 = row1.createCell(9);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(creator));
        sheet.setColumnWidth(9, 20 * 256);
        cell1 = row1.createCell(10);
        cell1.setCellStyle(cellStyleTitle);
        cell1.setCellValue(new HSSFRichTextString(entryDepartment));
        sheet.setColumnWidth(10, 20 * 256);
        String fileName = worksheetTitle;
        try {
            fileName = new String(fileName.getBytes("utf-8"), "ISO8859-1");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        response.reset();
        response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".xls");// 指定下载的文件名
        response.setContentType("application/vnd.ms-excel;charset=utf-8");
        try {
            OutputStream output = response.getOutputStream();
            wb.write(output);
            output.flush();
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }




}
